package com.jw.system.controller;


import com.jw.response.Result;
import com.jw.system.entity.Menu;
import com.jw.system.service.MenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 菜单表 前端控制器
 * </p>
 *
 * @author jw
 * @since 2021-04-20
 */
@RestController
@RequestMapping("/menu")
@Api(value = "系统菜单模块", tags = "系统菜单接口")
public class MenuController {

    @Autowired
    private MenuService menuService;

    /**
     * 加载菜单树
     *
     * @return
     */
    @ApiOperation(value = "加载菜单树", notes = "获取所有菜单树，以及展开项")
    @GetMapping("/getTree")
    public Result tree() {
        List<Menu> menuTree =  menuService.buildMenuTree();
        return Result.ok().data("menuTree",menuTree);
    }

}

